import { connect } from 'react-redux';
import { push } from 'react-router-redux';

import BodyDataInput from '../components/bodydatainput/BodyDataInput';
import { calcRiskAll, routedCategory } from '../actions/CalcRiskAction';

const mapStateToProps = (state, ownProps) => ({
  ...state.bodyData,
});
const mapDispatchToProps = (dispatch, ownProps) => ({
  onAction: (inputData, pageIndex) => {
    dispatch(routedCategory(undefined));

    console.log(inputData, pageIndex)

    dispatch(calcRiskAll(inputData, pageIndex));
    dispatch(push('/report'));
  },
  onCancel: () => {
    dispatch(push('/'));
  },
  pageNext: (inputData, pageIndex) => {
    // 処理なし
  },
  pageBack: (inputData, pageIndex) => {
    // 処理なし
  },
});

export default connect(mapStateToProps, mapDispatchToProps)(BodyDataInput)
